1. /* sdfentcn.cpp by K.Tsuru */
  2. // function ID = 3500 DRADIX, BRADIX
  3. /***************************************************
  4. SDouble and SDecimal classes
  5. It provides the entry of a constant function.
  6. userV : given by user
  7. snV : pointer to the variable which sets the result, snV!=NULL
  8. pfDefFunc : pointer to the function which calculate the constant when
  9. the number of figures is insufficient
  10. maxSize : the number of calculated figures
  11. The function prototype is declared in "snfunc.h".
  12. ****************************************************/
  13. #ifndef SN_H
  14. #include "sn.h"
  15. #endif
  16. static const char* func = "EntryConst";
  17. void EntryConst(const SDouble* userV, SDouble* snV,
  18. SDouble (*pfCalcFunc)(), uint* maxSize){
  19. //If there is no method to evaluate or "new" operator has not been used in the constant
  20. //function, it makes an error.
  21. if( (userV == NULL) && (pfCalcFunc == NULL) ) SNManager::SetError(SNManager::SYNTAX_ERR, func, 3500);
  22. if(snV == NULL) SNManager::SetError(SNManager::FATAL, func, 3500);
  23. uint max_sz = snV->MaxSize();
  24. uint snVSize = snV->Head() + 1u; // ver. 2.17 SDHead() --> Head()
  25. uint userSize = (userV != NULL) ? (userV->Head()+1u) : 0;
  26. if(snVSize < max_sz){
  27. if(userSize >= max_sz) *snV = *userV; //sufficient figures is given by "userV"
  28. else if(pfCalcFunc != NULL) *snV = (*pfCalcFunc)(); //calculation
  29. else snV->SetError(snV->SYNTAX_ERR, func, 3500); //no method to calculate
  30. }
  31. *maxSize = max_sz;
  32. }

sdfentcn.cpp : last modifiled at 2017/06/23 10:57:39(1,484 bytes)
created at 2017/10/07 10:22:50
The creation time of this html file is 2017/10/07 11:29:39 (Sat Oct 07 11:29:39 2017).